<template>
  <div>
    <public-modal
      width="880px"
      :footer="false"
      :title="title"
      :publicVisible="publicVisible"
      @handleOk="handleOk"
      @cancel="cancel"
    >
      <div slot="content" class="form-wrapper right-content">
        <div id="map-container"></div>
      </div>
      <div slot="footer"></div>
    </public-modal>
  </div>
</template>

<script>
import { checkIDCard } from '@/utils/validate.js'
import publicModal from '@/components/publicModal'
import { putAction, postAction } from '@/api/manage'

export default {
  name: 'addPoliceModal',
  components: { publicModal },
  data() {
    return {
      title: '位置信息',
      record: {},
      status: 0,
      publicVisible: false,
      imageUrl: [],
      fileList: [],
      showUploadList: { showPreviewIcon: false },
      form: {},
      rules: {},
      detail: {},
      bindDataList: [],
      wbHelpBean: {},
      wbHelpMentalPatientList: [],
      actionType: 'add',
    }
  },
  mounted() {},
  methods: {
    show(position) {
      this.publicVisible = true
      this.$nextTick(() => {
        // this.initMap(position)
      })
    },
    cancel() {
      this.publicVisible = false
    },
    initMap(position) {
      var marker,
        map = new AMap.Map('map-container', {
          resizeEnable: true,
          center: position,
          zoom: 13,
        })

      // 实例化点标记
      function addMarker(position) {
        marker = new AMap.Marker({
          icon: '//a.amap.com/jsapi_demos/static/demo-center/icons/poi-marker-default.png',
          position: position,
          offset: new AMap.Pixel(-13, -30),
        })
        marker.setMap(map)
      }

      addMarker(position)
    },
    handleOk() {},
  },
}
</script>

<style scoped lang="less">
#map-container {
  height: 500px;
}
</style>
